package main

import (
	"bytes"
	"fmt"
	"html/template"
)

type User struct {
	Title string
	Name  string
	Age   int
}

func main() {
	tmpl, _ := template.New("hello2.tpl").ParseFiles("./hello2.tpl")
	user1 := User{
		Title: "test",
		Name:  "zhanglin",
		Age:   18,
	}
	user2 := User{
		Title: "test",
		Name:  "liuwei",
		Age:   20,
	}
	var users []User
	users = append(users, user1)
	users = append(users, user2)
	var body bytes.Buffer
	err := tmpl.Execute(&body, users)
	fmt.Println(body.String())
	fmt.Println(err)

}
